<script type="text/javascript">
$(function(){
	$.fn.allselect({
			allselectclass:"allselect",
			cselectname: "c_selected"
	}); 
});
</script>
<div id="nav" class="mainnav_title">
    <ul>
        <a class="on" href="{:U('show_list')}">线路主题</a> |
        <a href="javascript:void(0);" onclick="art.dialog.open('{:U('add')}',{title:'回答问题',width:440,height:280,window:'top',lock:'true'});">添加</a>
    </ul>
</div>
<form name="myform" id="myform" action="" method="post">
    <div class="table-list">
        <table cellspacing="0" cellpadding="0" width="100%">
            <thead>
            <tr>
                <th><input type="checkbox" value="" class="allselect" id="check_box">
<label for="check_box" class="for_box">全选/反选</label></th>
                <th style="text-align: left;">名称</th>
                <th>排序</th>
                <th>操作</th>
            </tr>
			</thead>
			</tbody>
            <volist name="list" id="vo">
                <tr class="ulbc" id="tr_{$vo.id}">
                    <td id="td_sel"><input type="checkbox" class="sel c_selected" id="sel_{$vo.id}" value="{$vo.id}" name="items[$vo.id]"/></td>
                    <td style="text-align: left;"><input type="text" name="names_{$vo.id}" id="names_{$vo.id}"
                                                         value="{$vo.names}"/></td>
                    <td><input type="text" name="sort[{$vo.id}]" id="sort_{$vo.id}" value="{$vo.sort}"/></td>
                    <td>
                        <a href="javascript:void(0);" onclick="ajax_save('{$vo.id}')">保存</a>&nbsp;|&nbsp;
                        <a href="{:U('del',array('id'=>$vo['id']))}" onclick="return atr_confirm(this.href)">删除</a>
                    </td>
                </tr>
            </volist>
            </tbody>
        </table>
        <input type="hidden" name="base_pos" value="{~echo MODULE_NAME}">
    </div>
    <div class="btn">
        <input type="button" class="button" name="dosubmit" value="删除"
               onclick="myform.action='{:U('deleteall')}';return confirm_deleteall()"/>
        <input type="button" class="button" name="dosubmit" value="排序"
                   onclick="myform.action = '{:U('line/reset_sort',array('jumpurl'=>base64_encode('line_topic_type/show_list')))}'; $('#myform').trigger('submit');"/>
    </div>
</form>
<div class="page">{$page}</div>
<script language="javascript">
    function ajax_save(id) {
        var url = "ajax_save?id=" + id;
        var names = $('#names_' + id).val();
        var sort = $('#sort_' + id).val();

        $.ajax({
            url: url,
            type: "POST",
            complete: function () {
            },
            dataType: 'json',
            data: "names=" + names + "&sort=" + sort,
            error: function () {
                alert('Ajax request error');
            },
            success: function (result) {
                if (result == 1) {
                    showTips('保存成功', 33, 1);
                }
            }
        });
    }
</script>
<include file="Public:footer"/>